home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / MacApp / MacApp CD Release / MacApp 2.0.1 (Many Libraries) / Libraries / UTEView.Globals.p < prev    next >
Encoding:
Text File  |  1990-10-25  |  4.3 KB  |  178 lines  |  [TEXT/MPS ]

  1. {$P}
  2. {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
  3. {UTEView.Globals.p}
  4. { Copyright © 1985 - 1990 Apple Computer, Inc. All rights reserved. }
  5.  
  6. {--------------------------------------------------------------------------------------------------}
  7. {$S TEInit}
  8.  
  9. PROCEDURE InitUTEView;
  10.  
  11.     BEGIN
  12.     IF qTemplateViews THEN
  13.         BEGIN
  14.         { So linker doesn't strip TTEView class }
  15.         IF gDeadStripSuppression THEN
  16.             IF Member(TObject(NIL), TTEView) THEN;
  17.         RegisterStdType('TTEView', kStdTEView);
  18.         END;
  19.  
  20.     gUTEViewInitialized := TRUE;
  21.     END;
  22.  
  23. {--------------------------------------------------------------------------------------------------}
  24. {$S TEDebug}
  25.  
  26. PROCEDURE WriteChar(index: INTEGER;
  27.                     hText: Handle);
  28.  
  29.     CONST
  30.         kMaxIndex            = 2047;
  31.  
  32.     TYPE
  33.         x                    = PACKED ARRAY [0..kMaxIndex] OF Char;
  34.         XPtr                = ^x;
  35.         XHandle             = ^XPtr;
  36.  
  37.     BEGIN
  38.     IF index <= kMaxIndex THEN
  39.         Write('[', index: 1, ':', XHandle(hText)^^[index]: 1, '] ');
  40.     END;
  41.  
  42. {--------------------------------------------------------------------------------------------------}
  43. {$S TEDebug}
  44.  
  45. PROCEDURE DumpTERecord(aTEH: TEHandle);
  46.  
  47.     CONST
  48.         kMaxCharsToPrint    = 100;
  49.  
  50.     VAR
  51.         size:                INTEGER;
  52.         hText:                Handle;
  53.         i:                    INTEGER;
  54.  
  55.     BEGIN
  56.     Write('TE -- dest rect: '); WriteRect(aTEH^^.destRect);
  57.     WriteLn;
  58.  
  59.     size := aTEH^^.teLength;
  60.     Write('Line ht: ', aTEH^^.lineHeight: 1);
  61.     Write('; teLength: ', size: 1);
  62.     Write('; hText length: ', GetHandleSize(aTEH^^.hText): 1);
  63.     Write('; lines: ', aTEH^^.nLines: 1);
  64.     WriteLn;
  65.  
  66.     IF gIntenseDebugging THEN
  67.         BEGIN
  68.         hText := aTEH^^.hText;
  69.         Write('Chars: ');
  70.         FOR i := 0 TO Min(kMaxCharsToPrint, Min(2047, size - 1)) DO
  71.             BEGIN
  72.             WriteChar(i, hText);
  73.             IF i MOD 10 = 9 THEN
  74.                 WriteLn;
  75.             END;
  76.         WriteLn;
  77.  
  78.         Write('InPort vis bbox: '); WriteRect(aTEH^^.inPort^.visRgn^^.rgnBBox);
  79.         Write('; clip bbox: '); WriteRect(aTEH^^.inPort^.clipRgn^^.rgnBBox);
  80.         WriteLn;
  81.  
  82.         IF aTEH^^.inPort <> thePort THEN
  83.             BEGIN
  84.             Write('thePort vis bbox: '); WriteRect(thePort^.visRgn^^.rgnBBox);
  85.             Write('; clip bbox: '); WriteRect(thePort^.clipRgn^^.rgnBBox); WriteLn;
  86.             END;
  87.         END;
  88.  
  89.     END;
  90.  
  91. {--------------------------------------------------------------------------------------------------}
  92. {$S TEFields}
  93.  
  94. PROCEDURE DumpTTECommand(theTTECommand: TTECommand);
  95.  
  96.     TYPE
  97.         TSPtr                = ^TextStyle;
  98.  
  99.     VAR
  100.         i:                    LONGINT;
  101.         oldStyleSize:        LONGINT;
  102.         newStyleSize:        LONGINT;
  103.         last:                LONGINT;
  104.  
  105.     BEGIN
  106.     WITH theTTECommand DO
  107.         WriteLn('old start/end, new start/end, diff :', fOldStart: 0, '/', fOldEnd: 0, ',  ',
  108.                 fNewStart: 0, '/', fNewEnd: 0, ',  ', MAX(MAX(fOldEnd - fOldStart, 0), MAX(fNewEnd -
  109.                                                           fNewStart, 0)): 0);
  110.     WriteLn('fTextPad :', theTTECommand.fTextPad: 0);
  111.     WriteLn('fPadding size :', GetHandleSize(theTTECommand.fPadding): 0);
  112.  
  113.     oldStyleSize := 0;
  114.     newStyleSize := 0;
  115.     WriteLn('** Old styles:');
  116.     IF theTTECommand.fOldStyles = NIL THEN
  117.         WriteLn('NONE!')
  118.     ELSE
  119.         BEGIN
  120.         last := theTTECommand.fOldStyles^^.scrpNStyles;
  121.         WriteLn('Number of table entries: ', last: 0);
  122.         FOR i := 0 TO last - 1 DO
  123.             WITH theTTECommand.fOldStyles^^.scrpStyleTab[i] DO
  124.                 BEGIN
  125.                 Write(i: 0, ', ofs:', scrpStartChar: 0, ' ');
  126.                 WrLblField('', @scrpFont, bStyle);
  127.                 WriteLn;
  128.                 END;
  129.         oldStyleSize := GetHandleSize(Handle(theTTECommand.fOldStyles));
  130.         END;
  131.  
  132.     WriteLn('** New styles:');
  133.     IF theTTECommand.fNewStyles = NIL THEN
  134.         WriteLn('NONE!')
  135.     ELSE
  136.         BEGIN
  137.         last := theTTECommand.fNewStyles^^.scrpNStyles;
  138.         WriteLn('Number of table entries: ', last: 0);
  139.         FOR i := 0 TO last - 1 DO
  140.             WITH theTTECommand.fNewStyles^^.scrpStyleTab[i] DO
  141.                 BEGIN
  142.                 Write(i: 0, ', ofs:', scrpStartChar: 0, ' ');
  143.                 WrLblField('', @scrpFont, bStyle);
  144.                 WriteLn;
  145.                 END;
  146.         newStyleSize := GetHandleSize(Handle(theTTECommand.fNewStyles));
  147.         END;
  148.  
  149.     WriteLn('Styles size diff: ', MAX(newStyleSize, oldStyleSize): 0);
  150.     WriteLn('fStylePad :', theTTECommand.fStylePad: 0);
  151.     END;
  152.  
  153. {--------------------------------------------------------------------------------------------------}
  154. {$S TERes}
  155.  
  156. PROCEDURE SetSelect(theStart, theEnd: INTEGER;
  157.                     hTE: TEHandle);
  158.  
  159.     BEGIN
  160.     WITH hTE^^ DO
  161.         BEGIN
  162.         selStart := theStart;
  163.         selEnd := theEnd;
  164.         END;
  165.     END;
  166.  
  167. {--------------------------------------------------------------------------------------------------}
  168. {$S TENonRes}
  169.  
  170. FUNCTION ClickLoopForTTEView: BOOLEAN;
  171.  
  172.     BEGIN
  173.     IF pCurrTEView <> NIL THEN
  174.         ClickLoopForTTEView := pCurrTEView.ClikLoop
  175.     ELSE
  176.         ClickLoopForTTEView := TRUE;
  177.     END;
  178.